// components/tabbar-wrapper/tabbar-wrapper.js
Component({

  /**
   * 组件的属性列表
   */
  properties: {
    activeTab: {
      type: String,
      value: "home"
    },
  },

  /**
   * 组件的初始数据
   */
  data: {
    items: [{
        title: "主页",
        icon: "home-o",
        name: "home",
        route: "/pages/home/home",
      },
      {
        title: "我的",
        icon: "user-circle-o",
        name: "mine",
        route: "/pages/mine/mine",
      }
    ],
  },
  lifetimes: {
    attached() {}
  },
  /**
   * 组件的方法列表
   */
  methods: {
    onChange(event) {
      if (this.properties.activeTab != event.detail) {
        this.setData({
          activeTab: event.detail
        });

        wx.navigateTo({
          url: this.data.items.find(it => it.name == event.detail).route,
        })
      }
    }
  }
})